﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MVP_app_easy
{
    public class MainPresenter
    {
        private IModelInterface _model;
        private IView _view;


        public MainPresenter(IView view, IModelInterface model)
        {
            _model = model;
            _view = view;
            _view.btnNext_click += ShowNext;
            _view.btnPrevious_click += ShowPrevious;
            _view.btnReset_click += ResetValue;
        }

        public void Run()
        {
            _view.Show();
        }

        private void ShowNext(object sender, EventArgs e)
        {
            _view.TbText = _model.GetNextValue();
        }

        private void ShowPrevious(object sender, EventArgs e)
        {
            _view.TbText = _model.GetPreviousValue();
        }

        private void ResetValue(object sender, EventArgs e)
        {
           _view.TbText = _model.ResetPosition();
        }         
    }
}
